// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.16.10
package sys

import (
	"context"
	"hotgo/api/admin/activity"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	Activity = cActivity{}
)

type cActivity struct{}

// List 查看活动管理列表
func (c *cActivity) List(ctx context.Context, req *activity.ListReq) (res *activity.ListRes, err error) {
	list, totalCount, err := service.SysActivity().List(ctx, &req.ActivityListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.ActivityListModel{}
	}

	res = new(activity.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出活动管理列表
func (c *cActivity) Export(ctx context.Context, req *activity.ExportReq) (res *activity.ExportRes, err error) {
	err = service.SysActivity().Export(ctx, &req.ActivityListInp)
	return
}

// Edit 更新活动管理
func (c *cActivity) Edit(ctx context.Context, req *activity.EditReq) (res *activity.EditRes, err error) {
	err = service.SysActivity().Edit(ctx, &req.ActivityEditInp)
	return
}

// View 获取指定活动管理信息
func (c *cActivity) View(ctx context.Context, req *activity.ViewReq) (res *activity.ViewRes, err error) {
	data, err := service.SysActivity().View(ctx, &req.ActivityViewInp)
	if err != nil {
		return
	}

	res = new(activity.ViewRes)
	res.ActivityViewModel = data
	return
}

// Delete 删除活动管理
func (c *cActivity) Delete(ctx context.Context, req *activity.DeleteReq) (res *activity.DeleteRes, err error) {
	err = service.SysActivity().Delete(ctx, &req.ActivityDeleteInp)
	return
}

// Status 更新活动管理状态
func (c *cActivity) Status(ctx context.Context, req *activity.StatusReq) (res *activity.StatusRes, err error) {
	err = service.SysActivity().Status(ctx, &req.ActivityStatusInp)
	return
}